from flaskDemo.extensions.error import CustomExcetion
from flask import jsonify
def init_excetion(app):

    @app.errorhandler(Exception)
    def custome(e):
        if isinstance(e, CustomExcetion):
            return jsonify({
                'code': e.code,
                'message': e.message
            })
        elif e.code == 404:
            return '您访问的页面跑路了'



